package decorator;

//继承被装饰者
public class Decorator extends Drink{

    private Drink drink;

    public Decorator(Drink drink) {
        this.drink = drink;
    }

    //重写getDes和getPrice方法来修饰
    @Override
    public String getDes() {
        return drink.getDes() +
                " && " + super.getDes() + super.getPrice() ;
    }
    @Override
    public float getPrice() {
        return drink.getPrice() + super.getPrice();
    }

    @Override
    public void message() {
        float result = drink.getPrice() + super.getPrice();
        System.out.println("共消费：" + result + "元");
        System.out.println("消费详情：" + this.getDes());
    }


}
